﻿/* DotNetHoldem 
 * .Net Solution that allows to use OpenHoldem with .Net logic
 * Author: Óscar Andreu
 * oesido at gmail dot com
 * Licensed under GPLv3 - 2012
 */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DotNetBotLogic.Classes;
using DotNetBotLogic.Enums;
using DotNetBotLogic.Classes.BetRoundClasses;
using DotNetBotLogic.Classes.Log;

namespace DotNetBotLogic.Controllers
{
    internal class BaseController
    {
        #region Static

        internal static double BBlind = 0;       

        #endregion

        #region Variables

        protected int betTurn = 0;

        private BetRounds betRound;
        protected BetRounds BetRound
        {
            get { return betRound; }
            set 
            {
                if (betRound != value)
                {
                    betTurn = 0;
                }
                else
                {
                    betTurn++;
                }

                betRound = value; 
            }
        }

        #endregion

        internal BaseController()
        {
        }

        internal virtual double GetActionResult()
        {
            BetRound = OhHelper.GetBetRound();
            BetRoundBase brClass = null;

            if (BetRound == BetRounds.Preflop)
            {
                brClass = Preflop();
            }
            else if (BetRound == BetRounds.Flop)
            {
                brClass = Flop();
            }
            else if (BetRound == BetRounds.Turn)
            {
                brClass = Turn();
            }
            else if (BetRound == BetRounds.River)
            {
                brClass = River();
            }

            return brClass.getAction(); ;
        }

        protected virtual BetRoundBase Preflop() { return null; }
        protected virtual BetRoundBase Flop() { return null; }
        protected virtual BetRoundBase Turn() { return null; }
        protected virtual BetRoundBase River() { return null; }
    }
}
